#ifndef _CSVLOGOBJECT_H__
#define _CSVLOGOBJECT_H__

#include"ILogObject.h"

/************************************************
Notes:
	If time stamping is enabled, the first four
	columns are the time stamp, seperated into
	Hours, Minutes, Seconds, and Milliseconds.

	If a header is not specified, the default
	header is used, which is simply Message, or
	if time stamping is enabled, Message comes
	after the time stamp, so as to be the fifth
	column.
************************************************/

class CSVLogObject : public ILogObject
{
private:
	//Stores apointer to the stream object created in the Log class
	std::ofstream* mLogStream;

	//A boolean to keep track of time stamp usage
	bool mbUseTimeStamp;

	//The header, specified by the user. Given the default value of
	//Hours,Minutes,Seconds,Millis,Message if time stamping is enabled or,
	//Message is time stamping is disabled
	char * mpHeader;

public:
	CSVLogObject(bool useTimeStamp = false);
	CSVLogObject(const char* header, bool useTimeStamp);
	~CSVLogObject() { delete mLogStream; delete[] mpHeader; }

	//Sets the stream pointer stored in CSVLogObject, and writes the header to the file
	void Initialize(std::ofstream* stream);

	//Writes a line to the log file
	//If tim stamping is enabled the time stamp is automatically written
	void Write(const char* logline, va_list args);
};

#endif